<?php
	class PModel
	{
		var $puzzle;
		
		var $model_name;
		var $model_extension;
		var $_model;
		
		
		function PModel($owner, $extension, $name)
		{
			$this->puzzle = $owner;
			
			$this->model_name = $name;
                        $this->model_extension = $extension;
                        
			$this->_model->fields = array();
			
			$this->defineModel();
		}
		
		function defineModel()
		{
			//global $Puzzle;
			
			$prev_extension = $this->puzzle->PEM->current_extension;
                	$this->puzzle->PEM->useExtension($this->model_extension);
                	
			$DS = $this->puzzle->config['DS'];
			
			include $this->puzzle->config['dir_ext'] . $DS . $this->model_extension . $DS . $this->puzzle->config['dir_ext_src'] . $DS . $this->puzzle->config['dir_ext_models'] . $DS . $this->model_name . $DS . "def.php";
			
			$this->puzzle->PEM->useExtension($prev_extension);
		}
		
		function defineContainer($container_name)
		{
			//global $Puzzle;
			
			$prev_extension = $this->puzzle->PEM->current_extension;
                	$this->puzzle->PEM->useExtension($this->model_extension);
                	
			$DS = $this->puzzle->config['DS'];
			
			include $this->puzzle->config['dir_ext'] . $DS . $this->model_extension . $DS . $this->puzzle->config['dir_ext_src'] . $DS . $this->puzzle->config['dir_ext_models'] . $DS . $this->model_name . $DS . $container_name . ".php";
			
			$this->puzzle->PEM->useExtension($prev_extension);
		}
	}
?>
